package edu.whu.notepal.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import edu.whu.notepal.utils.MessageType;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author 陈磊
 */
@Data
public class SocketBean {

    private MessageType messageType;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long noteId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long fromUser;



    @JsonSerialize(using = ToStringSerializer.class)
    private Long toUser;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long fromGroup;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long toGroup;

    private Integer gameCategory;

    private String msg;

    private LocalDateTime dateTime;

    public static SocketBean reverseUser(SocketBean socketBean){
        Long toUser = socketBean.getToUser();
        socketBean.setToUser(socketBean.getFromUser());
        socketBean.setFromUser(toUser);
        return socketBean;
    }
}